package ar.edu.itba.it.cg.grupo01.impl.color;

import java.awt.Color;
import java.util.List;

import com.google.common.collect.ImmutableList;

import ar.edu.itba.it.cg.grupo01.api.color.ColorMode;

public class OrderedColorMode implements ColorMode {

	private final List<Color> colors;
	private final int size;
	private int current;

	public OrderedColorMode(final List<Color> colors) {
		this.colors = ImmutableList.copyOf(colors);
		current = 0;
		size = this.colors.size();
	}
	
	
	@Override
	public Color getColor() {
		final Color color = colors.get(current);
		current = (current + 1) % size;
		return color;
	}

}
